package org.elfen.common.scan;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.elfen.common.scan.BaseSysLogAspect4Around;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * 日志操作拦截器
 */
@Aspect  
@Component 
public class SysLogAop {
	@Autowired
	private BaseSysLogAspect4Around baseSysLogAspect;
	
	/** 
     * 定义拦截规则 
     */  
    @Pointcut("@within(org.springframework.web.bind.annotation.RestController)")  
    public void webRequestLog(){}
    
    /** 
     * 拦截器具体实现 
     * @param pjp 
     * @return JsonResult（被拦截方法的执行结果，或需要登录的错误提示。） 
     * @throws Throwable 
     */  
    @Around("webRequestLog()")
    public Object Interceptor(ProceedingJoinPoint joinPoint) throws Throwable{
    	System.out.println("--PlanWebLogAop 执行拦截--");
    	return baseSysLogAspect.aroundLog(joinPoint);
    }
}
